import java.util.*;
public class chentest1{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for(int i=0;i<t;i++){
            String s=sc.next();
            char a[]=s.toCharArray();
            int n=s.length();
            if(find(a, n)){
                System.out.println("yes");
            }else System.out.println("no");
            
        }
    }
    static boolean find(char arr[],int n){
        if ('0' <= arr[0] && arr[0] <= '9'||n<8){
            return false;
        }
        int s=0,x=0,d=0;
        for(int i=0;i<n;i++){
            if ('0' <= arr[i] && arr[i] <= '9')
            {
                s++;
                continue;

            }
            if ('a' <= arr[i] && arr[i] <= 'z')
            {
                x++;
                continue;

            }
            if ('A' <= arr[i] && arr[i] <= 'Z')
            {
                d++;
                continue;
            }
        }
        if ((d == 0 && x == 0) || (s == 0 && d == 0) || (x == 0 && s == 0) || (x == 0 && s == 0 && d == 0))//有字母数字，
        {
            return false;
        }
        if (n != (d + s + x))//有特殊字符
        {
            return false;
        }
        return true;
    }
}